year= 1970:1:2010;
type=1:1:2;
B=[.02 .018];
C=[39 35.06];
SD=[0.62 0.58; 0.56 0.58 ;0.53 0.58; 0.51 0.58 ; 0.48 0.58; 0.4 .58];
%obs=zeros(200000,6);
obs=zeros(600000,6)*10;
%I have 100000 observations per trial. 
%
%I first enumerate each 1 to 100K to be able to track them
for i=1:6
    obs(100000*(i-1)+1:100000*(i),1)=1:100000;
end
%}
%%Now I need to assign values relevant to each variable
%Year
for i=1:6
    for k=1:40
        obs(100000*(i-1)+2500*(k-1)+1:100000*(i-1)+2500*(k),2)=year(1,k);
    end
end
%Type
obs(:,3)=randsample(1:2, 600000, 1);
%Coautor
for i=1:600000
    if obs(i,3)==1    
        obs(i,4)=exp(B(1,1)*obs(i,2)-C(1,1));
    else
        obs(i,4)=exp(B(1,2)*obs(i,2)-C(1,2));
    end   
end
%
%Adding the randomness to Coathors + ~SD

for j=1:6
    for i=1:100000
       if obs(i+100000*(j-1),3)==1    
        obs(i+100000*(j-1),4)=obs(i+100000*(j-1),4)+normrnd(0,SD(j,1));
        obs(i+100000*(j-1),5)=SD(j,1)+(j-1);
        else
        obs(i+100000*(j-1),4)=obs(i+100000*(j-1),4)+normrnd(0,SD(j,2));
        obs(i+100000*(j-1),5)=SD(j,2)+(j-1);
       end
    end
end

% Journal Number
for i=1:600000
    if obs(i,3)==1    
        obs(i,6)=randsample (10:12,1,1);
    else
        obs(i,6)=randsample (13:15,1,1);
    end   
end

     

%}
%{
%%Creating the Dummy variable for afterXtype1
for i=1:1000000
    if obs(i,2)>=1980
        if obs(i,3)==1
            obs(i,5)=1;
        end
    end
end
%}
filename = 'experimentv3.csv';
csvwrite(filename,obs)

%}

